package com.hunlian.makelove.net.api;

import android.content.Context;

import com.google.gson.Gson;
import com.hunlian.makelove.bean.LookPhoneBean;
import com.hunlian.makelove.net.InterfaceServiceVisit;
import com.hunlian.makelove.net.ResponseCallbackListener;
import com.hunlian.makelove.net.ServiceInterfaceDef;
import com.hunlian.makelove.net.StringResponseCallbackListener;


/**
 * 查看对方电话邀请
 * @author zealjiang
 * @time 2015年11月23日下午2:08:24
 */
public class LookPhoneServiceVisit extends InterfaceServiceVisit {
	// 登录接口Id


	public LookPhoneServiceVisit(Context context) {
		super(context);

		setFunctionId(ServiceInterfaceDef.FUNC_ID_SEND_LOOK_PHONE);
	}

	// 填充参数
	public void setParamters(String userId,String oppositeUserId) {
		paramterData.put("userId", userId);
		paramterData.put("oppositeUserId", oppositeUserId);
	}

	public void getResult(final ResponseCallbackListener<LookPhoneBean,LookPhoneBean> listener) {
		doPost(getParamter(), new StringResponseCallbackListener() {
			@Override
			public void onSuccess(String data) {
				//Printout.println("查看对方电话邀请:"+data);
				if(listener != null){
					listener.onSuccess(null);
				}
			}

			@Override
			public void onFailure(String errCode, String errMessage,String data) {
				Gson gson = new Gson();
				LookPhoneBean bean = gson.fromJson(data,LookPhoneBean.class);
				if (listener != null) {
					listener.onFailure(errCode, errMessage,bean);
				}
			}
		});
	}


}
